<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:x="https://www.texmacs.org/2002/extensions" xmlns:m="http://www.w3.org/1998/Math/MathML">
  <head>
    <title>TeXmacs notes</title>
    <meta content="TeXmacs 1.99.15" name="generator"></meta>
    <link href="../resources/notes-base.css" type="text/css" rel="stylesheet"></link>
    <link href="../resources/blog-icon.png" rel="icon"></link>
    <script src="../resources/highlight.pack.js" language="javascript" defer></script>
    <script src="../resources/notes-base.js" language="javascript" defer></script>
  </head>
  <body>
    <div class="notes-header">
      <p>
        <img class="image" src="../resources/texmacs-blog-transparent.png" width="28.116784"></img><span style="margin-left: 2pt"></span><a href="./main.html">[main]</a><em
        class="notes-header-name">Notes on TeXmacs</em>
      </p>
    </div>
    <p>
      <a id="auto-1"></a>
    </p>
    <h1>Example of TikZ figure generation with the Graph plugin<span style="margin-left: 1em"></span></h1>
    <p>
      The <class style="font-variant: small-caps">Graph</class> plugin collect the interface to some
      useful image generation programs. Whenever possible a vector image in
      the <class style="font-variant: small-caps">PostScript</class> or <class style="font-variant: small-caps">Pdf</class> format
      is generated. Currently it supports the <a href="https://www.graphviz.org"><class style="font-variant: small-caps">Graphviz</class></a>
      suite and some LaTeX image generation packages like <a href="http://xy-pic.sourceforge.net"><class
      style="font-variant: small-caps">XyPic</class></a>, <a href="http://osksn2.hep.sci.osaka-u.ac.jp/~taku/osx/feynmp.html"><class style="font-variant: small-caps">FeynMF</class></a>, <a
      href="https://pgf-tikz.github.io"><class style="font-variant: small-caps">PGF/TikZ</class></a> and a direct interface to
      LaTeX/<class style="font-variant: small-caps">PDF</class>LaTeX for more complex layout or to use
      other packages.
    </p>
    <p>
      You may insert a <class style="font-variant: small-caps">Graph</class> session using <class class="tmweb-menu"
      style="font-family: sans-serif">Insert</class>&rarr;<class class="tmweb-menu" style="font-family: sans-serif">Session</class>&rarr;<class
      class="tmweb-menu" style="font-family: sans-serif">Graph</class><a id="auto-2"></a>. When you finished typing your
      input, press  <font class="tmweb-key">&#x21A9;</font> in order to compute the
      output. Multiline input is entered using <font class="tmweb-key">&#x21E7;&#x21A9;</font>.
    </p>
    <p>
      Type <tt class="verbatim">help</tt>, you will get all the available graph
      backends. 
    </p>
    <p>
      
    </p>
    <div class="compact-block" style="margin-top: 0.5em; text-indent: 0em">
      <p style="margin-top: 0.5em">
        <tt class="verbatim"><div style="margin-left: 42.175176192px">
          <div align="justify">
            Generate graphs with your favorite tools in GNU TeXmacs
          </div>
        </div></tt>
      </p>
    </div>
    <div class="compact-block" style="text-indent: 0em">
      <p>
        <tt class="verbatim"><div style="margin-left: 42.175176192px">
          <div align="justify">
            Created by Darcy Shen, Implemented in Python, asy[421ms] by
            default
          </div>
        </div></tt>
      </p>
    </div>
    <div class="compact-block" style="margin-bottom: 0.5em; text-indent: 0em">
      <p style="margin-bottom: 0.5em">
        <tt class="verbatim"><div style="margin-left: 42.175176192px">
          <div align="justify">
            Welcome to star and fork it at https://github.com/texmacs/plugins
          </div>
        </div></tt>
      </p>
    </div>
    <div class="compact-block" style="text-indent: 0em">
      <table style="width: 100%">
        <tbody><tr>
          <td style="padding-left: 0em; padding-right: 0em"><font color="#401000"><pre class="verbatim" xml:space="preserve">
asy] </pre></font></td>
          <td style="width: 100%; padding-left: 0em; padding-right: 0em"><font color="#000080"><pre class="verbatim" xml:space="preserve">
pdflatex</pre></font></td>
        </tr></tbody>
      </table>
    </div>
    <div class="compact-block" style="margin-top: 0.5em; margin-bottom: 0.5em; text-indent: 0em">
      <p style="margin-top: 0.5em; margin-bottom: 0.5em">
        <tt class="verbatim"><div style="margin-left: 42.175176192px">
          <div align="justify">
            TeXmacs interface to PDFLaTeX for picture generation
          </div>
        </div></tt>
      </p>
    </div>
    <div class="compact-block" style="text-indent: 0em">
      <table style="width: 100%">
        <tbody><tr>
          <td style="padding-left: 0em; padding-right: 0em"><font color="#401000"><pre class="verbatim" xml:space="preserve">
pdflatex] </pre></font></td>
          <td style="width: 100%; padding-left: 0em; padding-right: 0em"><font color="#000080"><pre class="verbatim" xml:space="preserve">
\documentclass[tikz]{standalone}
\usepackage{tikz-3dplot}

\begin{document}
\tdplotsetmaincoords{60}{120}

\begin{tikzpicture}[scale=3,tdplot_main_coords,axis/.style={-&gt;,blue,thick},
vector/.style={-stealth,red,very thick},vector guide/.style={dashed,red,thick}]

%standard tikz coordinate definition using x, y, z coords
\coordinate (O) at (0,0,0);

%tikz-3dplot coordinate definition using r, theta, phi coords
\tdplotsetcoord{P}{.8}{55}{60}

%draw axes
\draw[axis] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[axis] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[axis] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

%draw a vector from O to P
\draw[vector] (O) -- (P);

%draw guide lines to components
\draw[vector guide] (O) -- (Pxy);
\draw[vector guide] (Pxy) -- (P);

\end{tikzpicture}

\end{document}</pre></font></td>
        </tr></tbody>
      </table>
    </div>
    <div class="compact-block" style="margin-top: 0.5em; margin-bottom: 0.5em; text-indent: 0em">
      <p style="margin-top: 0.5em; margin-bottom: 0.5em">
        <tt class="verbatim"><div style="margin-left: 42.175176192px">
          <div align="justify">
            <img src="a-tikz-example-2.png" style="margin-left: 0em; margin-bottom: 0em; margin-right: 0em; margin-top: 0em; vertical-align: 0em; height: 21.3645656565657em"></img>
          </div>
        </div></tt>
      </p>
    </div>
    <div class="compact-block" style="margin-bottom: 0.5em; text-indent: 0em">
      <table style="width: 100%">
        <tbody><tr>
          <td style="padding-left: 0em; padding-right: 0em"><font color="#401000"><pre class="verbatim" xml:space="preserve">
pdflatex] </pre></font></td>
          <td style="width: 100%; padding-left: 0em; padding-right: 0em"><font color="#000080"><pre class="verbatim" xml:space="preserve">
</pre></font></td>
        </tr></tbody>
      </table>
    </div>
    <p>
      
    </p>
  </body>
</html>